﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using DevExpress.XtraReports.UI;
using DataAccess;

namespace QuanLyKhachSan
{
    public partial class XtraReportBangLuong : DevExpress.XtraReports.UI.XtraReport
    {
        private List<NhanVien> list = new List<NhanVien>();
        public XtraReportBangLuong(List<NhanVien> lis)
        {
            InitializeComponent();
            list = lis;
            Form_Load();
        }

        private void Form_Load()
        {
            foreach(var nv in list)
            {
            XRTableCell cell1 = new XRTableCell();
            XRTableCell cell2 = new XRTableCell();
            XRTableCell cell3 = new XRTableCell();
            XRTableCell cell4 = new XRTableCell();

            cell1.WidthF = 150;
            cell2.WidthF = 150;
            cell3.WidthF = 200;
            cell4.WidthF = 150;

            cell1.Text = nv.TenNhanVien;
            cell2.Text = nv.NgayLamViec.ToShortDateString();
            cell3.Text = nv.Chucvu.TenCV;
            cell4.Text = nv.HeSoLuong.ToString();

            XRTableRow xr = new XRTableRow();
            xr.Cells.Add(cell1);
            xr.Cells.Add(cell2);
            xr.Cells.Add(cell3);
            xr.Cells.Add(cell4);

            xrTable1.Rows.Add(xr);
            }
            xrTable1.Rows[0].Visible = false;
        }
        
    }
}
